﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Xml;
using XISoft.AppCreator.Util.Common;

namespace XISoft.AppCreator.Util.ConfigHelper.CodeConfig
{
    public class CodeConfig
    {

        private readonly static ConfigHelper<CodeConfigElement> config = new ConfigHelper<CodeConfigElement>(System.Environment.CurrentDirectory + @"\config\Code.config");

        private static String[] languages;

        public static String[] getAllLanguage()
        {
            if (languages == null)
            {
                languages = new String[config.Elements.Count];
                for (int i = 0; i < config.Elements.Count; i++)
                    languages[i] = config.Elements[i].Name;
            }

            return languages;

        }

        public static CodeConfigElement GetConfigSetting(String language)
        {
            foreach(CodeConfigElement e in config.Elements)
                if(e.Name.Equals(language))
                    return e;
            return null;
        }
    }
}
